package com.iuie.ns.devtools.element;

import com.iuie.ns.devtools.to.JavaBeanDevHeaderTO;
import com.iuie.ns.frame.utils.StringUtils;

public abstract class JavaBeanClassDevElement extends DevElement {
	
	private JavaBeanDevHeaderTO header;
	
	public JavaBeanClassDevElement(JavaBeanDevHeaderTO header) {
		this.header = header;
	}

	@Override
	protected String getPrefix() {
		long serialVersionUID = -System.currentTimeMillis();
		StringBuilder sb = new StringBuilder(12);
		// 拼接包路径
		if (StringUtils.isNotBlank(header.getPackagePath())) {
			sb.append("package " + header.getPackagePath() + ".vo" + ";\n\n");
		}
		// 导包
		sb.append("import java.io.Serializable;\n")
			.append("import java.util.Date;\n")
			.append("import com.fasterxml.jackson.annotation.JsonFormat;\n");
		// 类
		sb.append("\npublic class ")
			.append(header.getClassName())
			.append(" implements Serializable {\n\n")
			.append("\tpublic static final long serialVersionUID = ")
			.append(serialVersionUID)
			.append("L;\n\n");
		return sb.toString();
	}

	@Override
	protected String getSuffix() {
		return "}";
	}

}
